package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.TbUserMail;
import com.item.mapper.TbUserMailMapper;
import com.item.service.TbUserMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbUserMailServiceImpl implements TbUserMailService {

    @Autowired
    TbUserMailMapper tbUserMailMapper;


    public List<TbUserMail> findAll(int limit, int page, TbUserMail tbUserMail) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return tbUserMailMapper.findAll(tbUserMail);
    }


    public int add(TbUserMail tbUserMail) {

        return tbUserMailMapper.insertSelective(tbUserMail);
    }


    public int update(TbUserMail tbUserMail) {
        return tbUserMailMapper.updateByPrimaryKey(tbUserMail);
    }

    @Override
    public int delete(int id) {
        return tbUserMailMapper.deleteByPrimaryKey(id);
    }
}
